package org.grottarossa.query;

import org.apache.solr.client.solrj.SolrServer;

public class SolrServerCreator implements SearchEngineCreator
{	
	private SearchServer searchServer;
	private String serverType;
	
	@Override
	public synchronized SolrServer getServer() 
	{					
		if( serverType.equals(HTTP_SERVER))
		{
			return searchServer.getHttpSolrServer();
		}
		else if(serverType.equals(EMBEDDED_SERVER))
		{
			return searchServer.getEmbeddedSolrServer();	
		}
		else 
			return null;		
	}

	public SearchServer getSearchServer() {
		return searchServer;
	}

	public void setSearchServer(SearchServer searchServer) {
		this.searchServer = searchServer;
	}
	
	public String getServerType() {
		return serverType;
	}

	public void setServerType(String serverType) {
		this.serverType = serverType;
	}
}
